function initpayli(){
	var c=getUrlParms();
    console.log(g)
	var E=c.appName;
	var w=c.price;
	var e=c.tel;
	if(!E||E==""){
		E=c.appEname}
	if(E==null||typeof(E)=="undefined"){
		E=""
	}
	if(!w||w==""){
		w=c.price
	}
	if(!e||e==""){
		e=c.userName
	}

	if(E){
		E=decodeURI(E)
	}
	if(e&&e!=""){
		$("#mob").val(e.substr(-11))
	}
	var r=c.userName;
	var f=c.appName;
	var D=c.price;
	if(r&&f&&D){
		var n=f;
		if(n.indexOf("_")==-1){
			n=_getksbaoenname(n)
		}
		var g='{"userName":"'+r+'","appName":"'+n+'","price":"'+D+'"}';
		$("#userMessage").val(g)
	}
	var d=getProductTypeInfo(E,w);
	if(d){
		var x=0;
		var v=d.providers;
		//console.log(c);
		var y="";
		var u=E;
		if(u.indexOf("_")>0){
			u=_getksbaoecname(E)
		}
		if(u==null||u.length<1){
			u=E
		}
		for(var q=0;q<v.length;q++){
			var C=v[q];
			var l="<ul class='pl'>";
			if(d.items[q]){
				for(var j=0;j<d.items[q].length;j++){
					var z=d.items[q][j];

					l+='<li id="li_'+x+'"> <div class="provider">'+C+"</div><p>"+z.ver+"</p>";
					if(z.price!=z.sprice){
						l+=' <span style="padding-left:5px;text-decoration:line-through;color:#999999">\uffe5'+z.price+"</span>"
					}
					l+="<span>\uffe5"+z.sprice+"</span> ";
					if(z.note!=undefined){
						l+='<div class="note"><br/>'+z.note+"</div>"
					}
					l+="</li>";
					var o="";
					var m="";
					var A="";
					var k="0";
					if(z.resid){
						o=z.resid
					}

						if(o==""&&(z.type=="KSBD10101"||z.type=="KSBD10111"||z.type=="KSBD10121"||z.type=="KSBD29101")){o="KSBDJSJ"+z.ver.toLowerCase()}

						if((z.type=="KSBD10101"||z.type=="KSBD10111"||z.type=="KSBD10121"||z.type=="KSBD29101"||z.type=="exam6610121")){k="1"}

						if(z.checkbox){k=z.checkbox}

						if(z.productid){m=z.productid}

						if(z.express){A=z.express}var b=C+u+z.ver;
						if(z.type.indexOf("KSBD")==-1){b=C+z.ver}
						l+='<input type="hidden" id="items_'+x+'" name="items" value="'+x+'"" >';
						l+='<input type="hidden" id="items_type_'+x+'" value="'+z.type+'">';
						l+='<input type="hidden" id="items_title_'+x+'" value="'+b+'">';
						l+='<input type="hidden" id="items_price_'+x+'" value="'+z.price+'">';
						l+='<input type="hidden" id="items_sprice_'+x+'" value="'+z.sprice+'">';
						l+='<input type="hidden" id="items_resid_'+x+'" value="'+o+'">';
						l+='<input type="hidden" id="items_productid_'+x+'" value="'+m+'">';
						l+='<input type="hidden" id="items_provider_'+x+'" value="'+C+'">';
						l+='<input type="hidden" id="items_num_'+x+'" value="1">';
						l+='<input type="hidden" id="items_express_'+x+'" value="'+A+'">';
						l+='<input type="hidden" id="items_checkbox_'+x+'" value="'+k+'">';
						//增加catid
						l+='<input type="hidden" id="items_catid_'+x+'" value="'+z.catid+'">';
						x++}}


						l+="</ul>";var B="";

						if(d.items.length>1&&q!=(d.items.length-1)){
							B="<div class='plmore-next'>\u66f4\u591a...</div>"
						}else{
							if(d.items.length>1&&q==(d.items.length-1)){B="<div class='plmore-prev'>\u66f4\u591a...</div>"}}y+="<div class='swiper-slide'>"+l+B+"</div>"}$("#payli").html("<div class='swiper-container' id='swiper-pay'><div class='swiper-wrapper'>"+y+"</div></div>");$("#pay-title").text("\u8d2d\u4e70"+u);

							if(d.notes!=undefined){
								$("#payli").append("<div class='pl-notes'>"+d.notes[0]+"</div>")}}var a=setSwiper(v);

								$(".plmore-next").click(function(){a.slideNext()});
								$(".plmore-prev").click(function(){a.slideTo(0)});
								$("#mobclear").click(function(){$("#mob").val("")});
								$(".pl li").click(function(){var p=$(this).attr("id").split("_")[1];
								var i=$("#items_checkbox_"+p).val();
								if(i=="1"){$(this).toggleClass("curr")}else{var h=$(this).is(".curr");$(".pl li").removeClass("curr");if(h){$(this).removeClass("curr")}else{$(this).addClass("curr")}}sumAmount()});initCurr(d,E,w,a);autoSubmitOrder();if(d.providers.length==1){$("#pay-content").css("margin-top","0");
								$("#paytabindex").hide()}}
								var _getksbaoenname=function(a){for(var b=0;b<ksbaonamelist.length;b++){if(a==ksbaonamelist[b].name){return ksbaonamelist[b].enname}}return a};var _getksbaoecname=function(a){if(a!=null&&a.length>0){for(var b=0;b<ksbaonamelist.length;b++){if(ksbaonamelist[b].enname==a){return ksbaonamelist[b].name}}}return null};function autoSubmitOrder(){}function setSwiper(b){

									var a=new Swiper("#swiper-pay",{pagination:"#paytabindex",paginationClickable:true,paginationBulletRender:function(c,d){var e=b[c];return'<span class="'+d+'"> '+e+"</span>"},onSlideChangeEnd:function(c){$(".content").scrollTop(0)}});$(".tab-index td").on("touchstart mousedown",function(c){c.preventDefault();$(".tab-index .active").removeClass("active");$(this).addClass("active");a.slideTo($(this).index())});return a}function initCurr(b,c,d,a){if(d&&d.length>0){$(".pl li").each(function(f){var e=f;var k=document.getElementById("items_price_"+e);if(d==k.value){$(this).addClass("curr");var j=document.getElementById("items_provider_"+e);if(b.providers){var h=b.providers;for(var g=0;g<h.length;g++){if(g>0&&h[g]==j.value){a.slideTo(g);break}}}return false}});sumAmount()}}function ckmob(a){if(a==""){return false}if(isNaN(a)||(a.length!=11)){return false}var b=/^0{0,1}(13[0-9]|1[457][0-9]|18[0-9])[0-9]{8}$/;if(!b.test(a)){return false}return true}function getItemsParma(){var a="";$(".pl li").each(function(g){if($(this).hasClass("curr")){var l=g;a+="&items="+l;var b=document.getElementById("items_type_"+l);var h=document.getElementById("items_title_"+l);var e=document.getElementById("items_price_"+l);var m=document.getElementById("items_sprice_"+l);var k=document.getElementById("items_num_"+l);var d=document.getElementById("items_express_"+l);var j=document.getElementById("items_resid_"+l);var f=document.getElementById("items_productid_"+l);var c=document.getElementById("items_provider_"+l);if(b){a+="&ity_"+l+"="+b.value}if(h){a+="&iti_"+l+"="+encodeURI(h.value)}if(e){a+="&ipr_"+l+"="+e.value}if(m){a+="&isp_"+l+"="+m.value}if(k){a+="&inu_"+l+"="+k.value}if(d){a+="&iex_"+l+"="+d.value}if(j){a+="&iresid_"+l+"="+j.value}if(f){a+="&iproductid_"+l+"="+f.value}if(c){a+="&iprovider_"+l+"="+encodeURI(c.value)}}});return a}

									function sumAmount(){
										var e=0;
										var c=0;
										var f=0;
										var a="";
										var catid="";
										var b=0;
										$(".pl li").each(function(l){
											if($(this).hasClass("curr")){
												b++;
												var n=l;
												var m=document.getElementById("items_price_"+n);
												var p=m.value;
												var j=m.value;
												var h=document.getElementById("items_sprice_"+n);
												var o=document.getElementById("items_num_"+n).value;
												var r=document.getElementById("items_title_"+n).value;
												var k=document.getElementById("items_type_"+n).value;
												var ca=document.getElementById("items_catid_"+n).value;
												j=parseFloat(h.value);
												var q=parseFloat(p)*parseInt(o);
												var g=parseFloat(j)*parseInt(o);
												f+=q;
												c+=g;
												catid = ca;
												if(b>1){
													a+=b+"."
													catid+=","+ca
												}
												a+=r+"\n"
												//catid+=ca
											}
										});
										if(b>1){
											a="1."+a
										}
										var d=f-c;
										document.getElementById("totalfee").value=formatFee(c,2);
										document.getElementById("totalfeediv").innerHTML=formatFee(c,2)+"\u5143";
										document.getElementById("totalamount").value=formatFee(f,2);
										document.getElementById("defee").value=formatFee(d,2);
										document.getElementById("description").value=a
											document.getElementById("catid").value=catid
									}
									function formatFee(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)}

									function checkfrm(){if($("#totalfee").val()==""||$("#totalfee").val()=="0"){$.alert("\u8bf7\u9009\u62e9\u9700\u8981\u8d2d\u4e70\u7684\u5546\u54c1\u7c7b\u578b");return false}if($("#mob").val()==""){$.prompt("\u8bf7\u8f93\u5165\u60a8\u7684\u624b\u673a\u53f7",function(a){$("#mob").val(a)});$(".modal-text-input").attr("type","tel");return false}if(!ckmob($("#mob").val())){$.prompt("\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u624b\u673a\u53f7",function(a){$("#mob").val(a)});$(".modal-text-input").val($("#mob").val());$(".modal-text-input").attr("type","tel");return false}return true}function createVipPayment(e,a,d,c){var b="http://vip.exam66.com/servlet/com.uuoke.payment.action.createPaymentLogJsonpAction";b+="?orderNo="+e;b+="&paybank="+encodeURI(a);$.ajax({type:"get",async:false,url:b,dataType:"jsonp",jsonp:"jsonpCallback",success:function(f){if(f.code=="SUCCESS"){d(f)}else{c(f.msg)}},error:function(f,h,g){c(g)}})}


									function saveVipOrder(b){var a="http://kaoguo8.tool8.cc/m/t_pay.php";a+="?isPaymentLog="+b.isPaymentLog;a+="&accountid="+b.accountid;a+="&ordertype="+b.ordertype;a+="&banktype="+encodeURI(b.banktype);a+="&subject="+encodeURI(b.subject);a+="&tel="+b.tel;a+="&email="+b.email;a+="&openid="+b.openid;a+="&qq="+b.qq;a+="&toAddress="+encodeURI(b.toAddress);a+="&toPerson="+encodeURI(b.toPerson);a+="&description="+encodeURI(b.description);a+="&userMessage="+encodeURI(b.userMessage);a+="&totalfee="+b.totalfee;
									a+="&catid="+b.catid;
									a+=getItemsParma();
									location.href=a;

									$.ajax({type:"get",async:false,url:a,dataType:"jsonp",jsonp:"jsonpCallback",success:function(c){if(c.code=="SUCCESS"){b.success(c)}else{b.error(c.msg)}},error:function(c,e,d){b.error(d)}})}


									function createNativeWxOrder(b,f,e,c,g,a){if(!g||g==""){$.alert("out_trade_no\u53c2\u6570\u4e0d\u6b63\u786e");return}var d="http://www.exam66.net/servlet/com.yihu.wxpay.action.unifiedorderAction";d+="?trade_type=NATIVE";d+="&body="+encodeURI(b);d+="&detail="+encodeURI(f);d+="&product_id="+e;d+="&total_fee="+c;d+="&out_trade_no="+g;$.ajax({type:"GET",async:false,url:d,dataType:"jsonp",jsonp:"jsonpCallback",success:function(h){if(h.return_code=="SUCCESS"){a(h)}else{if(h.return_code=="FAIL"){$.alert("\u5fae\u4fe1\u7edf\u4e00\u4e0b\u5355\u5931\u8d25\uff1a"+h.return_msg)}}},error:function(h,j,i){if(j!="200"){$.alert("\u5fae\u4fe1\u7edf\u4e00\u4e0b\u5355\u8bf7\u6c42\u5931\u8d25("+j+")")}}})}function createJsapiWxOrder(h,b,f,e,c,g,a){if(!isWeixin()){$.alert("\u5f53\u524d\u73af\u5883\u4e0d\u652f\u6301\u5fae\u4fe1\u652f\u4ed8,\u8bf7\u4f7f\u7528\u5176\u5b83\u65b9\u5f0f\u8d2d\u4e70\u3002");return}if(!h||h==""){$.alert("openid \u53c2\u6570\u4e0d\u6b63\u786e");return}var d="http://www.exam66.net/servlet/com.yihu.wxpay.action.unifiedorderAction";d+="?openid="+h;d+="&trade_type=JSAPI";d+="&body="+encodeURI(b);d+="&detail="+encodeURI(f);d+="&product_id="+e;d+="&total_fee="+c;d+="&out_trade_no="+g;$.ajax({type:"GET",async:false,url:d,dataType:"jsonp",jsonp:"jsonpCallback",success:function(j){if(j.return_code=="SUCCESS"){var k=j.appId;var i=j.timeStamp;var l=j.nonceStr;var n=j.prepaypackage;var m=j.paySign;jsApiCall(k,i,l,n,m,a)}else{if(j.return_code=="FAIL"){$.alert("\u5fae\u4fe1\u7edf\u4e00\u4e0b\u5355\u5931\u8d25\uff1a"+j.return_msg)}}},error:function(i,k,j){if(k!="200"){$.alert("\u5fae\u4fe1\u7edf\u4e00\u4e0b\u5355\u8bf7\u6c42\u5931\u8d25("+k+")")}}})}function jsApiCall(c,b,d,f,e,a){WeixinJSBridge.invoke("getBrandWCPayRequest",{appId:c,timeStamp:b,nonceStr:d,"package":f,signType:"MD5",paySign:e},a)};
